program shooting;
{$I+,S+,Q+,R+}

const
  inf = 'shooting3.in';
  ouf = '';
  //     shooting3.ans
  maxn = 2000;
  maxm = 2000;
  maxl = 4;
  modes = 10000;

type integer = longint;
     TData = array[1 .. maxn] of integer;
     TBig = array[0 .. maxm] of integer;
     TNum = object
       g: TBig;
       flag: integer;
       procedure MultSig(k: integer);
       procedure AddSig(k: integer);
       procedure DivSig(k: integer);
       procedure AddBig(var c: TNum);
       procedure print;
     end;

var a, b, c: TData;
    n, m, n0, n1, n2: integer;

procedure swap(var i, j: integer);
var temp: integer;
begin
  temp := i; i := j; j := temp;
end;

function compare1(var a, b: TBig): integer;
var i: integer;
begin
  if a[0] > b[0] then exit(1) else
  if a[0] < b[0] then exit(-1) else
    for i := a[0] downto 1 do begin
      if a[i] > b[i] then exit(1);
      if a[i] < b[i] then exit(-1);
    end;
  exit(0);
end;

function compare(var a, b: TNum): integer;
begin
  if a.g[0] = 0 then a.flag := 1;
  if b.g[0] = 0 then b.flag := 1;
  if a.flag > b.flag then exit(1);
  if a.flag < b.flag then exit(-1);
  compare :=  compare1(a.g, b.g) * a.flag;
end;

procedure AddBig1(var a, b: TBig);
var i: integer;
begin
  if b[0] > a[0] then a[0] := b[0];
  for i := 1 to a[0] do begin
    a[i] := a[i] + b[i];
    if a[i] >= modes then begin
      a[i] := a[i] - modes;
      inc(a[i + 1]);
    end;
  end;
  if a[a[0] + 1] > 0 then inc(a[0]);
end;

procedure MinusBig1(var a, b: TBig);
var i: integer;
begin
  for i := 1 to a[0] do begin
    a[i] := a[i] - b[i];
    if a[i] < 0 then begin
      inc(a[i], modes);
      dec(a[i + 1]);
    end;
  end;
  while (a[0] > 0) and (a[a[0]] = 0) do dec(a[0]);
end;

procedure DivSig1(var a: TBig; k: integer);
var i, temp: integer;
begin
  temp := 0;
  for i := a[0] downto 1 do begin
    temp := temp * modes + a[i];
    a[i] := temp div k;
    temp := temp - a[i] * k;
  end;
  while (a[0] > 0) and (a[a[0]] = 0) do dec(a[0]);
end;

procedure MultSig1(var a: TBig; k: integer);
var i, temp: integer;
begin
  temp := 0;
  for i := 1 to a[0] do begin
    a[i] := a[i] * k + temp;
    temp := a[i] div modes;
    a[i] := a[i] - temp * modes;
  end;
  if temp > 0 then begin
    inc(a[0]);
    a[a[0]] := temp;
  end;
end;

var f: TBig;

procedure TNum.AddBig(var c: TNum);
begin
  if flag = c.flag then AddBig1(g, c.g) else
  if compare1(g, c.g) = 1 then MinusBig1(g, c.g) else begin
    f := c.g;
    MinusBig1(f, g);
    g := f;
    flag := c.flag;
  end;
end;

procedure TNum.AddSig(k: integer);
var i, temp: integer;
begin
  k := k * flag;
  if g[0] < 3 then begin
    temp := g[2] * modes + g[1];
    if temp + k < 0 then begin
      k := - (temp + k);
      flag := - flag;
      g[1] := 0; g[2] := 0; g[0] := 0;
    end;
  end;
  i := 1;
  while k <> 0 do begin
    if i > g[0] then g[0] := i;
    g[i] := g[i] + k; k := 0;
    if g[i] >= modes then begin
      g[i] := g[i] - modes;
      k := 1;
    end else
    if g[i] < 0 then begin
      g[i] := g[i] + modes;
      k := k - 1;
    end;
    i := i + 1;
  end;
  while (g[0] > 0) and (g[g[0]] = 0) do dec(g[0]);
end;

procedure TNum.DivSig(k: integer);
begin
  if k < 0 then begin
    flag := -flag;
    k := -k;
  end;
  DivSig1(g, k);
end;

procedure TNum.MultSig(k: integer);
begin
  if k < 0 then begin
    flag := -flag;
    k := -k;
  end;
  MultSig1(g, k);
end;

procedure Qsort(var a: TData; n: integer);

  procedure sort(l, r: integer);
  var i, j, mid: integer;
  begin
    i := l; j := r; mid := a[(l + r) shr 1];
    while i <= j do begin
      while a[i] < mid do i := i + 1;
      while a[j] > mid do j := j - 1;
      if i <= j then begin
        swap(a[i], a[j]);
        i := i + 1; j := j - 1;
      end;
    end;
    if i < r then sort(i, r);
    if l < j then sort(l, j);
  end;

begin
  if n < 2 then exit;
  sort(1, n);
end;

procedure prepare;
var i, p: integer;
begin
  n0 := 0; n1 := 0; n2 := 0;
  for i := 1 to n do begin
    read(p);
    if p = 0 then inc(n0) else
    if p > 0 then begin
      inc(n1);
      a[n1] := p;
    end else begin
      inc(n2);
      b[n2] := p;
    end;
  end;
  Qsort(a, n1);
  Qsort(b, n2);
  for i := 1 to n2 do b[i] := -b[i];
end;

procedure init(var a: TNum; k: integer);
begin
  fillchar(a, sizeof(a), 0);
  a.flag := 1;
  if k < 0 then begin
    a.flag := -1;
    k := -k;
  end;
  if k > 0 then begin
    a.g[1] := k;
    a.g[0] := 1;
  end;
end;

procedure print1(var a: TBig);
var i: integer;
    st: string[15];
begin
  write(a[a[0]]);
  for i := a[0] - 1 downto 1 do begin
    st := ''; str(a[i], st);
    while length(st) < maxl do st := '0' + st;
    write(st);
  end; writeln;
end;

procedure TNum.print;
begin
  if g[0] = 0 then flag := 1;
  if flag < 0 then write('-');
  print1(g);
end;

var sum, s, product, ss, ss1: TNum;

procedure main;
var i, j, k, p, s1, suffix: integer;
    answer: boolean;
begin
  if m = 1 then begin
    if n0 > 0 then writeln(0) else begin
      init(s, 1);
      for i := 1 to n1 do s.MultSig(a[i]);
      for i := 1 to n2 do s.MultSig(- b[i]);
      s.print;
    end;
    exit;
  end;

  (*  algorithm1  *)
  answer := false; init(s, 0);
  for i := 1 to maxn do c[i] := 1;

  if n0 = 0 then begin

    init(product, 1); suffix := n1 + 1;
    for i := 0 to n2 do if not odd(i) then begin
      if i > 0 then begin
        inc(n1); a[n1] := b[i - 1] * b[i];
        c[n1] := b[i];
        j := n1;
        while (j > 1) and (a[j] < a[j - 1]) do begin
          swap(a[j], a[j - 1]);
          swap(c[j], c[j - 1]);
          j := j - 1;
        end;

        if j >= suffix then begin
          product.MultSig(c[j]);
          product.MultSig(a[j] div c[j]);
        end else inc(suffix);
      end;

      init(sum, 0);
      if n1 > 0 then k := 1 else k := 0;
      k := k + (n2 - i);
      if k > m then continue;
      if n1 + (n2 - i) < m then break;
      k := m - (n2 - i);
      while suffix < k do begin
        j := suffix;
        if a[j] <= modes then product.DivSig(a[j]) else begin
          product.DivSig(c[j]);
          product.DivSig(a[j] div c[j]);
        end;
        inc(suffix);
      end;
      while suffix > k do begin
        j := suffix - 1;
        if (j = 0) then break;
        if a[j] < modes then product.MultSig(a[j]) else begin
          product.MultSig(c[j]);
          product.MultSig(a[j] div c[j]);
        end;
        suffix := j;
      end;
      for j := 1 to k - 1 do sum.AddSig(a[j]);
      for j := i + 1 to n2 do sum.AddSig(- b[j]);
      sum.AddBig(product);
      if (not answer) or (compare(sum, s) = 1) then begin
        s := sum;
        answer := true;
      end;
    end;

    s.print;
    exit;
  end;

  if n0 >= m then n0 := m - 1; suffix := n1 + 1; init(product, 1);

  for i := 0 to n2 do if not odd(i) then begin
    if i > 0 then begin
      inc(n1); a[n1] := b[i - 1] * b[i]; c[n1] := b[i];
      j := n1;
      while (j > 1) and (a[j] < a[j - 1]) do begin
        swap(a[j], a[j - 1]);
        swap(c[j], c[j - 1]);
        j := j - 1;
      end;

      if j >= suffix then begin
        product.MultSig(c[j]);
        product.MultSig(a[j] div c[j]);
      end else inc(suffix);
    end;

    init(sum, 0);
    if n1 + (n2 - i) + n0 < m then break;
    k := m - n0 - (n2 - i); if k < 1 then k := 1;
    while suffix < k do begin
      j := suffix;
      if a[j] <= modes then product.DivSig(a[j]) else begin
        product.DivSig(c[j]);
        product.DivSig(a[j] div c[j]);
      end;
      inc(suffix);
    end;
    while suffix > k do begin
      j := suffix - 1;
      if a[j] < modes then product.MultSig(a[j]) else begin
        product.MultSig(c[j]);
        product.MultSig(a[j] div c[j]);
      end;
      suffix := j;
    end;
    for j := 1 to k - 1 do sum.AddSig(a[j]);
    for j := n2 downto n2 - (m - n0 - k) + 1 do sum.AddSig(- b[j]);
    ss := sum; ss.AddBig(product); j := m - n0 - k;
    repeat
      if (k = n1) or (j = 0) then break;
      if a[k] <= modes then product.DivSig(a[k]) else begin
        product.DivSig(c[k]);
        product.DivSig(a[k] div c[k]);
      end;
      inc(suffix);
      sum.AddSig(b[n2 - j + 1]);
      sum.AddSig(a[k]);
      ss1 := sum; ss1.AddBig(product);
      if compare(ss1, ss) = 1 then ss := ss1 else break;
      k := k + 1; j := j - 1;
    until false;
    s1 := 0;
    for p := k to n1 do if a[p] = 1 then inc(s1);
    if k + s1 > n1 then dec(s1);
    if s1 > n0 - 1 then s1 := n0 - 1;
    if s1 > 0 then ss.AddSig(s1);

    if not answer or (compare(ss, s) = 1) then begin
      answer := true;
      s := ss;
    end;
  end;
  s.print;
end;

var
  task, nowCase : integer;

begin
  assign(input, inf); assign(output, ouf);
  reset(input); rewrite(output);
  read(task);
  for nowCase := 1 to task do
  begin
    read(n, m);
    prepare;
    main;
  end;
  close(input); close(output);
end.

